package com.grape.dto;

import com.grape.domain.Account;
import com.grape.utils.BigDecimalUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class FinancialAccountDTO {

        /** 账户id */
    @ApiModelProperty(value = "账户id")
    private String id;

    /** 账户图标 */
    @ApiModelProperty(value = "账户图标")
    private String icon;

    /** 账户颜色 */
    @ApiModelProperty(value = "账户颜色")
    private String color;

    /** 账户名称 */
    @ApiModelProperty(value = "账户名称")
    private String name;

    /** 卡号后四位 */
    @ApiModelProperty(value = "卡号后四位")
    private String lastFourDigitsOfCard;

    /** 总支出 */
    @ApiModelProperty(value = "总支出")
    private Double totalExpenses;

    /** 总资产 */
    @ApiModelProperty(value = "总资产")
    private Double totalProperty;

    public void initByAccount(Account account) {
        this.setId(account.getId());
        this.setIcon(account.getIcon());
        this.setName(account.getName());
        this.setLastFourDigitsOfCard(account.getLastFourDigitsOfCard());
        this.setTotalExpenses(BigDecimalUtil.getDoubleValue(account.getTotalExpenses()));
        this.setTotalProperty(BigDecimalUtil.getDoubleValue(account.getProperty()));
        this.setColor(account.getColor());
    }

}
